<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>管理控制台</title>
    <!-- JQuery -->
    <script src="/static/js/jquery.min.js"></script>
    <!-- Bootstrap核心CSS 、JS-->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!-- 适用于Surface /台式机Windows 8错误的IE10视口黑客 -->
    <script src="https://v3.bootcss.com/assets/js/ie10-viewport-bug-workaround.js"></script>
    <link href="https://v3.bootcss.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
    <!-- 样式 -->
    <link href="/static/css/manage.css" rel="stylesheet">
    <script type="text/javascript">

        $(function () {
            /* 当点击菜单 */
            $("#menu li").click(function () {
                /* 移除全部样式 */
                $("#menu li").removeClass("active");
                /* 给当前添加样式 */
                $(this).addClass("active");
            });

            /* 获取用户登录信息 */
            $.getJSON(
                "/sa/getInfo",
                {},
                function (json) {
                    if (json.statusCode !== 200){
                        alert("权限不足，请用管理员账号登录！")
                        location.href="/admin";
                        return false;
                    }
                    $("#userName").html(json.data.realname);
                    $("#login").remove();
                },
                "json"
            );
        });

        function searchKey() {
            let key = $("#key").val();
            window.frames['_view'].location.href = "https://m.baidu.com/s?&wd=" + key;
        }

    </script>
</head>

<body>
<!-- 导航 -->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">导航条</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">WTUShop</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-link">
                <li><a href="/admin/navigation" target="_view">业务导航</a></li>
                <li><a href="/home" target="_view">商城首页</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <button type="button" class="btn btn-primary navbar-btn" onclick="searchKey()">
                        <span class="glyphicon glyphicon-search"></span> 搜索
                    </button>
                </li>
                <li><a href="/register">注册</a></li>
                <li id="login"><a href="/login">登录</a></li>
                <li><a href="#"><span class="glyphicon glyphicon-user"></span><span id="userName">请登录</span></a></li>
            </ul>
            <form class="navbar-form navbar-right">
                <label for="key"></label><input type="text" class="form-control" placeholder="输入内容" id="key">
            </form>
        </div>
    </div>
</nav>

<!-- 左边菜单 -->
<div class="container-fluid">
    <div class="row">
        <div id="menu" class="col-sm-3 col-md-2 sidebar">
            <ul class="nav nav-sidebar">
                <li class="active"><a href="/admin/goods" target="_view">商品列表 </a></li>
                <li><a href="/admin/goods/add" target="_view">添加</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/category" target="_view">类别列表</a></li>
                <li><a href="/admin/category/add" target="_view">添加</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/kill/" target="_view">秒杀活动</a></li>
                <li><a href="/admin/kill//add" target="_view">添加</a></li>
<!--                <li><a href="/admin/category/edit" target="_view">编辑</a></li>-->
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/shopping" target="_view">购物车</a></li>
                <li><a href="/admin/order" target="_view">订单列表</a></li>
                <li><a href="/admin/userAdmin" target="_view">用户管理</a></li>
            </ul>

            <a href="/sa/signOut">
                <button style="width: 100%" class="btn btn-danger">退出登录</button>
            </a>
        </div>
        <!-- 业务窗口 -->
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <!-- iframe -->
            <iframe id="_view" name="_view" width="100%" height="90%" frameborder="0"
                    src="/admin/navigation"></iframe>
        </div>
    </div>
</div>

</body>
</html>